/* function makeitso() {
  servidor.open("GET","dados.php?q="+str,true);
  servidor.onreadystatechange= processaResposta;
  servidor.send();
  } */
function listaJogadores(periodo)
{
    
    //makeitso();
    var xmlhttp;
    

    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp = new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    var id_time=1;
    //alert(xmlhttp.readyState);
    xmlhttp.onreadystatechange = function()
    {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
            document.getElementById("txtHint").innerHTML = "";
            
            id_time = 1;
            var onclick = "";
            //alert(xmlhttp.responseText);
            jogadores = eval("("+xmlhttp.responseText+")");
            //alert(classes[2].id_liga);
            //onclick="onclick="+"form('"+usr[tripulante].nome+"','"+usr[tripulante].email+"','"+usr[tripulante].logname+"','"+usr[tripulante].senha+"','"+usr[tripulante].cpf+"','"+usr[tripulante].nascimento+"','"+usr[tripulante].sexo+"','"+usr[tripulante].estadoCivil+"');";
            var s = "";
            var i=0;
            for (tripulante in jogadores) {
                s +="<tr><td><input type='hidden' name='jogador"+i+"' value='"+jogadores[tripulante].id_jogador+"'>"+jogadores[tripulante].nome+"<select name='posicao"+i+"'><option value='goleiro'>Goleiro</option><option value='fixo'>Fixo</option><option value='ala'>Ala</option><option value='pivo'>Pivo</option><option value='reserva'>Reserva</option><option value=''></option><select></td></tr>";
                document.getElementById("txtHint").innerHTML= "<form name='escalacao' method='POST' action='controleJogo.php?acao=jogo'><input type='hidden' name='periodo' value='"+periodo+"'><table>"+s+"</table><input type='submit' value='Jogar' onclick='verificadados();'></form>";
                //alert(onclick);
                i++;
            }
        }
    }
    id_time=document.getElementById("id_time").valueOf().value;
    //alert(id_time);
    xmlhttp.open("GET", "../View/gerajogo.php?acao=listajogadores&id_time="+id_time, true);
    xmlhttp.send();
    
}